package cn.vcjf.washcar.washcarorder.entity;

import cn.vcjf.washcar.common.util.IdGen;
import cn.vcjf.washcar.common.web.PageModel;
import cn.vcjf.washcar.system.entity.SysUser;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import org.apache.shiro.SecurityUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 洗车订单表
 * </p>
 *
 * @author zhengzihang
 * @since 2018-07-17
 */
@TableName("wash_car_order")
public class WashCarOrder extends PageModel<WashCarOrder> {

	private static final long serialVersionUID = 1L;

	@TableId(value = "id", type = IdType.AUTO)
	private Integer id;

	/**
	 * 用户名称
	 */
	@TableField(exist = false)
	private String userName;
	/**
	 * 用户电话
	 */
	@TableField(exist = false)
	private String userPhone;

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPhone() {
		return userPhone;
	}

	public void setUserPhone(String userPhone) {
		this.userPhone = userPhone;
	}

	/**
	 * 订单编号
	 */
	private String orderNo;

	/**
	 * 用户id
	 */
	private Integer userId;

	/**
	 * 订单状态(1下单中,2下单成功,3支付成功,4支付失败,5已撤销,6)
	 */
	private Integer status;

	/**
	 * 服务类型(洗车类型)
	 */
	private Integer serverType;

	/**
	 * 服务状态
	 */
	private Integer serviceStatus;

	/**
	 * 洗车时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date washStartTime;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date washEndTime;
	/**
	 * 洗车时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date createTimeBegDate;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date createTimeEndDate;
	/**
	 * 洗车时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date payTimeBegDate;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@TableField(exist = false)
	private Date payTimeEndDate;

	@Override
	public Date getCreateTimeBegDate() {
		return createTimeBegDate;
	}

	@Override
	public void setCreateTimeBegDate(Date createTimeBegDate) {
		this.createTimeBegDate = createTimeBegDate;
	}

	@Override
	public Date getCreateTimeEndDate() {
		return createTimeEndDate;
	}

	@Override
	public void setCreateTimeEndDate(Date createTimeEndDate) {
		this.createTimeEndDate = createTimeEndDate;
	}

	public Date getPayTimeBegDate() {
		return payTimeBegDate;
	}

	public void setPayTimeBegDate(Date payTimeBegDate) {
		this.payTimeBegDate = payTimeBegDate;
	}

	public Date getPayTimeEndDate() {
		return payTimeEndDate;
	}

	public void setPayTimeEndDate(Date payTimeEndDate) {
		this.payTimeEndDate = payTimeEndDate;
	}

	/**
	 * 订单类型(预约订单,)
	 */
	private Integer orderType;

	/**
	 * 洗车地点
	 */
	private String washAddress;

	/**
	 * 车辆信息
	 */
	private String carInfo;

	/**
	 * 洗车价格(单位)
	 */
	private BigDecimal money;

	/**
	 * 优惠价格(单位)
	 */
	private BigDecimal discounts;

	/**
	 * 洗车地点纬度
	 */
	private Double latitude;

	/**
	 * 洗车地点经度
	 */
	private Double longitude;

	/**
	 * 用户留言
	 */
	private String note;

	/**
	 * 用户评论
	 */
	private String comment;
	/**
	 * 支付时间
	 */
	private Date payTime;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getServerType() {
		return serverType;
	}

	public void setServerType(Integer serverType) {
		this.serverType = serverType;
	}

	public Integer getServiceStatus() {
		return serviceStatus;
	}

	public void setServiceStatus(Integer serviceStatus) {
		this.serviceStatus = serviceStatus;
	}

	public Date getWashStartTime() {
		return washStartTime;
	}

	public void setWashStartTime(Date washStartTime) {
		this.washStartTime = washStartTime;
	}

	public Date getWashEndTime() {
		return washEndTime;
	}

	public void setWashEndTime(Date washEndTime) {
		this.washEndTime = washEndTime;
	}

	public Integer getOrderType() {
		return orderType;
	}

	public void setOrderType(Integer orderType) {
		this.orderType = orderType;
	}

	public String getWashAddress() {
		return washAddress;
	}

	public void setWashAddress(String washAddress) {
		this.washAddress = washAddress;
	}

	public String getCarInfo() {
		return carInfo;
	}

	public void setCarInfo(String carInfo) {
		this.carInfo = carInfo;
	}

	public BigDecimal getMoney() {
		return money;
	}

	public void setMoney(BigDecimal money) {
		this.money = money;
	}

	public BigDecimal getDiscounts() {
		return discounts;
	}

	public void setDiscounts(BigDecimal discounts) {
		this.discounts = discounts;
	}

	public Double getLatitude() {
		return latitude;
	}

	public void setLatitude(Double latitude) {
		this.latitude = latitude;
	}

	public Double getLongitude() {
		return longitude;
	}

	public void setLongitude(Double longitude) {
		this.longitude = longitude;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Date getPayTime() {
		return payTime;
	}

	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}

	@Override
	public void preInsert() {
		super.preInsert();
		SysUser user = (SysUser) SecurityUtils.getSubject().getSession().getAttribute("currentUser");
		this.setUserId(user.getId());
		this.setOrderNo(IdGen.getAutoOrderNo());
	}

	@Override
	public void preUpdate() {
		super.preUpdate();
	}

	@Override
	public String toString() {
		return "WashCarOrder{" +
				"id=" + id +
				", orderNo=" + orderNo +
				", userId=" + userId +
				", status=" + status +
				", serverType=" + serverType +
				", serviceStatus=" + serviceStatus +
				", washStartTime=" + washStartTime +
				", washEndTime=" + washEndTime +
				", orderType=" + orderType +
				", washAddress=" + washAddress +
				", carInfo=" + carInfo +
				", money=" + money +
				", discounts=" + discounts +
				", payTime=" + payTime +
				", latitude=" + latitude +
				", longitude=" + longitude +
				", note=" + note +
				", comment=" + comment +
				", createUser=" + createUser +
				", createTime=" + createTime +
				", updateUser=" + updateUser +
				", updateTime=" + updateTime +
				", deleteFlag=" + deleteFlag +
				"}";
	}
}
